package com.fzb.forum4j.dao.impl;

import org.springframework.stereotype.Repository;

import com.fzb.forum4j.dao.api.IBlogSortDao;
import com.fzb.forum4j.po.Blog;
import com.fzb.forum4j.po.BlogSort;
import com.fzb.forum4j.po.QueryMode;
import com.fzb.forum4j.po.User;
@Repository("blogSortDaoImpl")
public class BlogSortDaoImpl extends HibBaseImpl<BlogSort> implements IBlogSortDao {

	@Override
	public void getBlogSortByUser(QueryMode<User> queryMode) {
		queryMode.getData().put("blogSort",getSession().createQuery(
				"select new map(t.sortName as sortName,t.bsId as id) from BlogSort t where t.user.userName=:userName"
				).setParameter("userName", queryMode.getT().getUserName()).list());
	}

	@Override
	public void getBlogSortByUserName(QueryMode<Blog> qmd) {
		qmd.getData().put("blogSort",getSession().createQuery(
				"select new map(t.sortName as sortName,t.bsId as id) from BlogSort t where t.user.userName=:userName"
				).setParameter("userName", qmd.getT().getUser().getUserName()).list());
		
	}
 

}
 